<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>

<form action="<?php echo url_for('presentation/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?token='.$form->getObject()->gettoken() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?> id="form-presentation">
  <?php echo $form->renderHiddenFields() ?>
  <?php if ($form->hasGlobalErrors()): ?>
    <ul class="error">
      <?php foreach ($form->getGlobalErrors() as $name => $error): ?>
        <li><?php echo $name.': '.$error ?></li>
      <?php endforeach; ?>
    </ul>
  <?php endif; ?>

  <?php if (!$form->getObject()->isNew()): ?>
    <input type="hidden" name="sf_method" value="put" />
  <?php endif; ?>

  <fieldset id="properties" class="form-fieldset collapsible">
    <legend>Properties</legend>
    <div class="form-row">
      <?php echo $form['title']->renderLabel() ?>
      <?php echo $form['title']->renderError() ?>
      <?php echo $form['title']->render(array('class' => 'default')) ?>
      <?php echo $form['title_short']->renderLabel() ?>
      <?php echo $form['title_short']->renderError() ?>
      <?php echo $form['title_short']->render(array('class' => 'short')) ?>
    </div>
    <div class="form-row">
      <?php echo $form['author']->renderLabel() ?>
      <?php echo $form['author']->renderError() ?>
      <?php echo $form['author']->render(array('class' => 'default')) ?>
      <?php echo $form['author_short']->renderLabel() ?>
      <?php echo $form['author_short']->renderError() ?>
      <?php echo $form['author_short']->render(array('class' => 'short')) ?>
    </div>
    <div class="form-row">
      <?php echo $form['date']->renderLabel() ?>
      <?php echo $form['date']->renderError() ?>
      <?php echo $form['date']->render(array('class' => 'default')) ?>
      <?php echo $form['date_short']->renderLabel() ?>
      <?php echo $form['date_short']->renderError() ?>
      <?php echo $form['date_short']->render(array('class' => 'short')) ?>
    </div>
    <div class="form-row">
      <?php echo $form['institute']->renderLabel() ?>
      <?php echo $form['institute']->renderError() ?>
      <?php echo $form['institute']->render(array('class' => 'default')) ?>
      <?php echo $form['institute_short']->renderLabel() ?>
      <?php echo $form['institute_short']->renderError() ?>
      <?php echo $form['institute_short']->render(array('class' => 'short')) ?>
    </div>
  </fieldset>

  <fieldset id="theme" class="form-fieldset collapsible">
    <legend>Theme</legend>
    <div class="form-row">
      <?php echo $form['theme']->renderLabel() ?>
      <?php echo $form['theme']->renderError() ?>
      <?php echo $form['theme'] ?>
      <?php echo $form['colortheme']->renderLabel() ?>
      <?php echo $form['colortheme']->renderError() ?>
      <?php echo $form['colortheme'] ?>
    </div>
  </fieldset>

  <fieldset id="privacy" class="form-fieldset collapsible">
    <legend>Privacy</legend>
    <div class="form-row">
      <?php echo $form['is_public']->renderLabel() ?>
      <?php echo $form['is_public']->renderError() ?>
      <?php echo $form['is_public'] ?>
    </div>
  </fieldset>

  <div>
    <a href="<?php echo url_for('presentation/index') ?>" class="button">Cancel</a>
    <?php if (!$form->getObject()->isNew()): ?>
      &nbsp;<?php echo link_to('Delete', '@presentation_delete?token='.$form->getObject()->gettoken(), array('method' => 'delete', 'confirm' => 'Are you sure?', 'class' => 'button negative')) ?>
    <?php endif; ?>
    <button type="submit" class="button positive">Save</button>
  </div>
</form>
